const axios = require('axios')
const express = require('express')
const router = express.Router()
const cheerio = require('cheerio')
router.get('/ip', (req, res, next) => {
  console.log(req.ip)
  axios.get('http://ip.chinaz.com/').then(result => {
    // console.log(result.data)
    const $ = cheerio.load(result.data)
    const ip = $('dd.fz24').text()
    res.send(ip)
  })
})
module.exports = router
